//
//  TableViewMinHeaderFooterView.m
//  YiCuiMiaoZhang
//
//  Created by Sings on 2019/4/8.
//  Copyright © 2018 益萃网络科技（中国）有限公司. All rights reserved.
//

#import "TableViewMinHeaderFooterView.h"
#import "BZThemeKeyConst.h"


@interface TableViewMinHeaderFooterView ()

@property (nonatomic, strong) TableViewMinHeaderFooterViewModel *viewModel;

@end

@implementation TableViewMinHeaderFooterView

@synthesize viewModel = _viewModel;

+ (instancetype) baseTableViewHeaderFooterViewWithTableView:(BaseTableView *)tableView {
    static NSString *headerId = @"TABLEVIEWMINHEADERFOOTERVIEWID";
    TableViewMinHeaderFooterView *headerFooterView = [tableView dequeueReusableHeaderFooterViewWithIdentifier:headerId];
    if (headerFooterView == nil) {
        headerFooterView = [[TableViewMinHeaderFooterView alloc] initWithReuseIdentifier:headerId];
    }
    return headerFooterView;
}

- (instancetype) initWithReuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithReuseIdentifier:reuseIdentifier]) {
//        self.contentView.backgroundColor = [UIColor groupTableViewBackgroundColor];
        BZTHEME_COLOR(skin_page_bg_color,self.contentView,backgroundColor);
    }
    return self;
}

- (void) setViewModel:(TableViewMinHeaderFooterViewModel *)viewModel  {
    _viewModel = viewModel;
    
    [self showView];
}

- (void) showView {
    if (self.viewModel.height == CGFLOAT_MIN) {
        self.alpha = 0.;
    }else {
        self.alpha = 1.;
    }
}



@end
